<template>
  <div class="home-container">
    <!-- 欢迎区域 -->
    <div class="welcome-section">
      <h1>欢迎使用 猎图图</h1>
      <p>探索 AI 驱动的图像处理功能，让您的创意无限可能</p>
    </div>

    <!-- 功能卡片区域 -->
    <div class="features-grid">
      <el-row :gutter="20">
        <el-col :xs="24" :sm="12" :md="8" :lg="6" v-for="feature in features" :key="feature.id">
          <el-card class="feature-card" :body-style="{ padding: '0px' }" @click="navigateToFeature(feature.path)">
            <div class="feature-image">
              <el-image 
                :src="feature.image" 
                fit="cover"
                :preview-src-list="[feature.image]"
              >
                <template #error>
                  <div class="image-error">
                    <el-icon><Picture /></el-icon>
                    <span>图片加载失败</span>
                  </div>
                </template>
              </el-image>
            </div>
            <div class="feature-content">
              <h3>{{ feature.title }}</h3>
              <p>{{ feature.description }}</p>
            </div>
          </el-card>
        </el-col>
      </el-row>
    </div>

  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { Picture } from '@element-plus/icons-vue'
import { ElScrollbar } from 'element-plus'

const router = useRouter()

const features = [
  {
    id: 1,
    title: '头发染色',
    description: '使用 AI 技术为照片中的人物头发更换颜色',
    image: '/images/home/hairRecolor.png',
    path: '/hairrecolor'
  },
  {
    id: 2,
    title: '美容美颜',
    description: '智能美化面部，让您更加光彩照人',
    image: '/images/home/faceBeauty.png',
    path: '/facebeauty'
  },
  {
    id: 3,
    title: '二次元风',
    description: '将照片转换为动漫风格，展现独特的艺术效果',
    image: '/images/home/convertoAnime.png',
    path: '/convert_to_anime'
  }
]

const navigateToFeature = (path) => {
  router.push(path)
}
</script>

<style scoped>
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.welcome-section {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
  border-radius: 8px;
}

.welcome-section h1 {
  font-size: 2.5rem;
  color: #2c3e50;
  margin-bottom: 16px;
}

.welcome-section p {
  font-size: 1.2rem;
  color: #5c6b7f;
  max-width: 600px;
  margin: 0 auto;
}

.features-grid {
  margin-bottom: 40px;
}

.feature-card {
  margin-bottom: 20px;
  transition: transform 0.3s ease;
  height: 100%;
  cursor: pointer;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-image {
  height: 200px;
  overflow: hidden;
}

.feature-image .el-image {
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.feature-card:hover .feature-image .el-image {
  transform: scale(1.05);
}

.feature-content {
  padding: 20px;
}

.feature-content h3 {
  font-size: 1.5rem;
  color: #2c3e50;
  margin-bottom: 12px;
}

.feature-content p {
  color: #5c6b7f;
  margin-bottom: 0;
  min-height: 48px;
}

.guide-section {
  background-color: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.guide-section h2 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 30px;
}

.image-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: #f5f7fa;
  color: #909399;
}

.image-error .el-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .home-container {
    padding: 10px;
  }

  .welcome-section {
    padding: 20px 10px;
    margin-bottom: 20px;
  }

  .welcome-section h1 {
    font-size: 1.8rem;
  }

  .welcome-section p {
    font-size: 1rem;
  }

  .feature-card {
    margin-bottom: 15px;
  }

  .feature-image {
    height: 200px;
  }

  .feature-content {
    padding: 5px;
  }

  .feature-content h3 {
    font-size: 1.2rem;
  }

  .feature-content p {
    font-size: 0.9rem;
    min-height: 40px;
  }

  .guide-section {
    padding: 20px;
  }

  .guide-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }

  :deep(.el-steps) {
    padding: 0 10px;
  }

  :deep(.el-step__title) {
    font-size: 0.9rem;
  }

  :deep(.el-step__description) {
    font-size: 0.8rem;
  }
}
</style> 